<?php
require_once( "include/incMain.php" );


$action = $_REQUEST['action']; 


function getLogs() {
    $retVal = "";
    
    $sql = "SELECT logs.id, logs_events.description, logs.message, logs.event_time FROM logs, logs_events WHERE logs_events.id = logs.event ORDER BY logs.event_time ";
	$result = sql($sql);
    while($row = mysql_fetch_array( $result )) {
        $retVal[] = array( "id" => $row['id'], 
                           "event" => $row['description'], 
                           "message" => $row['message'],
                           "time" => $row['event_time'] );
    }
    return $retVal;
}
function flushLogs() {
    $sql = "DELETE FROM logs ";
	$result = sql($sql);
}


if($action=="flush") flushLogs();



$smarty = new mySmarty();
$smarty->assign("Path", glPath );
$smarty->assign("logs", getLogs() );
$smarty->assign("menue", getMenue(1) );
$smarty->display(glPath.'/index.htm');


?>
